package org.iocdemo.springiocdemo.controller;

import jakarta.annotation.Resource;
import org.iocdemo.springiocdemo.model.Student;
import org.iocdemo.springiocdemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;

@Controller
public class UserController {
    @Autowired
    private UserService service;
    @Resource(name = "s1")
    private Student student;

    public UserController set(UserService u) {
        this.service=u;
        return this;
    }
//    @Bean()
//    public Student s1(){
//        return new Student("李飒",20);
//    }

    public void print(){
        System.out.println("do controller");
        service.print();
        System.out.println(student.getName());
    }
}
